Skip to content

Conversation

@js-murph
Copy link
Collaborator

What?

Migrates the git clone component of the git strategy into a separate API

Why?

Experimentation on implementing private repo support for the gomod strategy in #56 revealed we are likely better off separating the git clone behaviour so that it can be shared between multiple strategies.

@js-murph js-murph requested a review from alecthomas as a code owner January 23, 2026 04:30
m.clones[upstreamURL] = repo
m.clonesMu.Unlock()

return nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think at this point we've discovered the git repo, so we can return fs.SkipDir to not recurse further.

Comment on lines +266 to +268
"-c", "http.postBuffer="+strconv.Itoa(config.GitConfig.PostBuffer),
"-c", "http.lowSpeedLimit="+strconv.Itoa(config.GitConfig.LowSpeedLimit),
"-c", "http.lowSpeedTime="+strconv.Itoa(int(config.GitConfig.LowSpeedTime.Seconds())),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice


r.mu.Lock()
r.lastFetch = time.Now()
r.mu.Unlock()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be keeping the lock while we're fetching?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes... it also made me realise that I think we probably have another locking issue where we probably need read locks as well for consumers 🤔

return
}
// #nosec G204 - repo.Path() is controlled by us
cmd := exec.CommandContext(ctx, "git", "-C", repo.Path(), "bundle", "create", "-", "--branches", "--remotes")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should still be here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was answered in #58 (comment)... correct me if there's a separate concern here.

@js-murph js-murph requested a review from a team as a code owner January 26, 2026 22:16
@js-murph js-murph requested review from alecthomas and removed request for a team January 26, 2026 22:16
@js-murph js-murph merged commit ecf5911 into main Jan 26, 2026
6 checks passed
@js-murph js-murph deleted the johnm/refactor-git-clone-api branch January 26, 2026 23:15
@js-murph js-murph mentioned this pull request Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants